﻿@{
    jutehui.Model.Product m = new jutehui.Model.Product();
    if (Model != null)
    {
        m = (jutehui.Model.Product)Model;
    }


}

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" type="text/css" href="../css/sharestyle.css" />
    <script type="text/javascript" src="../js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="../js/weixin.js"></script>
    <title>@m.Pname</title>
    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
        }

        a {
            text-decoration: none;
        }

        img {
            max-width: 100%;
            height: auto;
        }

        .weixin-tip {
            display: none;
            position: fixed;
            left: 0;
            top: 0;
            bottom: 0;
            background: rgba(0,0,0,0.8);
            filter: alpha(opacity=80);
            height: 100%;
            width: 100%;
            z-index: 100;
        }

            .weixin-tip p {
                text-align: center;
                margin-top: 10%;
                padding: 0 5%;
            }
    </style>
</head>
<body>
   
        @{
            if (Model == null)
            { <div class="down">
                <div class="down-left" style="">
                    <img src="../Images/logo.png" />
                    <div style=" float:left;"><h1 style="padding-top:4px; margin:0px; line-height:24px;">寐淘<br /> <font style="font-size:14px; line-height:24px; padding-top:0px; ">下载获取更多优惠</font></h1></div>
                </div>
                <div class="down-right" style="background-color: #95c32f; border-radius:5px;width:20%" onclick="func()">
                    下载

                </div>
            </div>
            <p>來晚啦，商品飛走了</p>
            }
            else
            {
                var imgutl = "";
                if (m.ImgUrl.Contains("dpdisplay1"))
                {
                    imgutl = m.ImgUrl.Split('-').ToList()[0];
                }
                else
                {
                    imgutl = m.ImgUrl;
                }
                <img src=@imgutl /> 

                <div class="content" style="margin-bottom:50px">
                    <p class="tit">@m.Pname</p>
                    @{
                var pris = m.Source + " " + m.Price;
                    }
                    <p class="price">@pris</p>
                    @{
                if (m.ImgUrl2 != null && m.ImgUrl2 != "")
                {
                    <img src=@m.ImgUrl2 />
                }
                if (m.ImgUrl3 != null && m.ImgUrl3 != "")
                {
                    <img src=@m.ImgUrl3 />
                }
                var des = @m.Description.Replace("<p>", "").Replace("<br/>","</p>").Replace("</p>", "|").Split('|');

                    }
                    @{
                if (des != null)
                {
                    var list = des.ToList();
                    for (int k = 0; k < list.Count; k++)
                    {
                        <p>@list[k]</p>
                    }
                }

                    }



                </div>
                <div class="buybut" id=@m.Plink style="position: fixed; bottom: 0; width: 40%; right: 0; background-color: #95c32f;" onclick="GoBuy()">
                    去购买
                </div>
             <div class="buybut"  style="position: fixed; bottom: 0; width: 40%" onclick="func()">
                    下载寐淘
                </div>
                <div class="weixin-tip">
                    <p>
                        <img src="../Images/live_weixin.png" alt="微信打开" />
                    </p>
                </div>
            }
        }
    
    <script type="text/javascript">
        var OSIndex;
        function zhezhao() {
            var u = navigator.userAgent;

            if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) {
                OSIndex = 1;
            }
            else if (u.indexOf("iPhone")) {
                OSIndex = 2;
            }
            var winHeight = $(window).height();
            function is_weixin() {
                var ua = navigator.userAgent.toLowerCase();
                if (ua.match(/MicroMessenger/i) == "micromessenger") {
                    return true;
                } else {
                    return false;
                }
            }
            var isWeixin = is_weixin();
            if (isWeixin) {
                $(".weixin-tip").css("height", winHeight);
                $(".weixin-tip").show();
            }
        }
        //购买
        function GoBuy() {
            zhezhao()
            var plink = $(".buybut").attr("id")
            window.location.href = plink;
            var winHeight = $(window).height();
            function is_weixin() {

                var ua = navigator.userAgent.toLowerCase();
                if (ua.match(/MicroMessenger/i) == "micromessenger") {
                    return true;
                } else {
                    return false;
                }
            }
            var isWeixin = is_weixin();
            if (isWeixin) {
                $(".weixin-tip").css("height", winHeight);
                $(".weixin-tip").show();
            }
        }
        var func = function () {
            zhezhao()
            if (OSIndex == 1) {
                window.location.href = "http://www.maytao.cn/down/maytao.apk";
            }
            else {
                window.location.href = "http://www.maytao.cn/down/maytao.apk";
            }
            //else if (OSIndex == 2) {
            //    window.location.href = "http://itunes.apple.com/app/id1054877233";
            //}
            var winHeight = $(window).height();
            function is_weixin() {

                var ua = navigator.userAgent.toLowerCase();
                if (ua.match(/MicroMessenger/i) == "micromessenger") {
                    return true;
                } else {
                    return false;
                }
            }
            var isWeixin = is_weixin();
            if (isWeixin) {
                $(".weixin-tip").css("height", winHeight);
                $(".weixin-tip").show();
            }
        }

    </script>

</body>

</html>
